#include <stdio.h>

int month[12]={31,28,31,30,31,30,31,31,30,31,30,31};

int isleap(int y){
    return y%4==0&&y%100!=0||y%400==0;
}

int sum_day(int y,int m,int d){
    int i,leap=isleap(y),days=0;
    if (m<0||m>11) return -1;
    if (d<0||d>month[m-1]) return -1;
    for (i=1;i<m;i++){
        days+=month[i-1] + (leap&&i==2?1:0);
    }
    return days+d;
}

int main(){
    // 日期 --> 这年第几天
    int y,m,d;
    scanf("%d %d %d",&y,&m,&d);
    printf("days:%d\n",sum_day(y,m,d));
    return 0;
}